package net.zdreamer.geracomium.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.example.geracomium.R;

import net.zdreamer.geracomium.ui.more.JoinUsActivity;
import net.zdreamer.geracomium.ui.more.PersonalCenterActivity;
import net.zdreamer.geracomium.ui.more.ReserveBedActivity;
import net.zdreamer.geracomium.ui.more.ReserveFoodActivity;
import net.zdreamer.geracomium.ui.more.ServiceQuerryAcitivity;

public class MoreFragment extends Fragment implements OnClickListener {
    private LinearLayout Self_center, Service_query, Ordering, Subscribe,
            Join_Us;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_more, container, false);

    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        init();
        initListener();
    }

    protected void init() {

        Self_center = (LinearLayout) getView().findViewById(R.id.more_center);
        Service_query = (LinearLayout) getView().findViewById(
                R.id.more_service_query);
        Ordering = (LinearLayout) getView().findViewById(R.id.more_Ordering);
        Subscribe = (LinearLayout) getView().findViewById(R.id.more_subscribe);
        Join_Us = (LinearLayout) getView().findViewById(R.id.more_Join_Us);

    }

    protected void initListener() {
        // TODO Auto-generated method stub
        Self_center.setOnClickListener(this);
        Service_query.setOnClickListener(this);
        Ordering.setOnClickListener(this);
        Subscribe.setOnClickListener(this);
        Join_Us.setOnClickListener(this);
    }

    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch (v.getId()) {
            case R.id.more_center:
                Intent personal = new Intent(getActivity(),
                        PersonalCenterActivity.class);
                startActivity(personal);
                break;
            case R.id.more_service_query:
                Intent Service_query = new Intent(getActivity(),
                        ServiceQuerryAcitivity.class);
                startActivity(Service_query);
                break;
            case R.id.more_Ordering:
                Intent Oredering = new Intent(getActivity(),
                        ReserveFoodActivity.class);
                startActivity(Oredering);
                break;
            case R.id.more_subscribe:
                Intent Subscribe = new Intent(MoreFragment.this.getActivity(),
                        ReserveBedActivity.class);
                startActivity(Subscribe);
                break;
            case R.id.more_Join_Us:
                Intent Join_Us = new Intent(getActivity(), JoinUsActivity.class);
                startActivity(Join_Us);
                break;
            default:
                break;
        }
    }

}
